package com.ywjt.platformbusiness.widget;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.base.BaseBottomDialog;

public class CallPhoneBottomDialog extends BaseBottomDialog {

    private TextView tvCallPhone;
    private TextView tvCancel;
    private Context context;

    public CallPhoneBottomDialog(Context context ) {
        this.context = context;
    }

    @Override
    public int getLayoutRes() {
        return R.layout.dialog_callservice_pick;
    }

    @Override
    public void bindView(View v) {
        tvCallPhone = v.findViewById(R.id.tvCallPhone);
        tvCancel = v.findViewById(R.id.tvCancel);
        tvCallPhone.setOnClickListener(new clickListener());
        tvCancel.setOnClickListener(new clickListener());
    }

    private class clickListener implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.tvCallPhone:
                    dismiss();
                    //拨打电话
                    Intent intent = new Intent(Intent.ACTION_DIAL);
                    Uri data = Uri.parse("tel:" + "4001330177");
                    intent.setData(data);
                    startActivity(intent);
                    break;
                case R.id.tvCancel:
                    dismiss();
                    break;
            }
        }
    }
}
